package com.meetingshow.meeting.uiservice.model;

import java.util.Date;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;

import com.meetingshow.common.base.uiservice.model.BaseVO;
import com.meetingshow.meeting.dao.model.MeetingPO;

public class MeetingVO extends BaseVO {
    
    public final static String NON_RECOMMAND = "0";
    
    /**
     * 
     */
    private static final long serialVersionUID = 3305278570950540692L;
    
    private Integer meetingId;
    private String abstracT;
    private Double charge;
    private CityVO city = new CityVO();
    private String contactor;
    private String contactFax;
    private String contactPhone;
    private String coOrganizer;
    private Date createTime;
    private String email;
    private Date endDate;
    private Integer hot;
    private String image;
    private IndustryVO industry = new IndustryVO();
    private String location;
    private MeetingTypeVO meetingType = new MeetingTypeVO();
    private String name;
    private String nameEn;
    private String organizer;
    private Integer recommend;
    private String sponsor;
    private Date startDate;
    private Integer valuable;
    private String website;
    private String weiboName;
    private String weiboUrl;
    private Integer followCount;
    private String description;
    
    public MeetingVO() {
    }
    
    public MeetingVO(MeetingPO meetingPO) {
        setMeetingId(meetingPO.getMeetingId());
        setAbstracT(meetingPO.getAbstracT());
        setCharge(meetingPO.getCharge());
        setCity(new CityVO(meetingPO.getCity()));
        setContactor(meetingPO.getContactor());
        setContactFax(meetingPO.getContactFax());
        setContactPhone(meetingPO.getContactPhone());
        setCoOrganizer(meetingPO.getCoOrganizer());
        setCreateTime(meetingPO.getCreateTime());
        setEmail(meetingPO.getEmail());
        setEndDate(meetingPO.getEndDate());
        setHot(meetingPO.getHot());
        setImage(meetingPO.getImage());
        setIndustry(new IndustryVO(meetingPO.getIndustry()));
        setLocation(meetingPO.getLocation());
        setMeetingType(new MeetingTypeVO(meetingPO.getMeetingType()));
        setName(meetingPO.getName());
        setNameEn(meetingPO.getNameEn());
        setOrganizer(meetingPO.getOrganizer());
        setRecommend(meetingPO.getRecommend());
        setSponsor(meetingPO.getSponsor());
        setStartDate(meetingPO.getStartDate());
        setValuable(meetingPO.getValuable());
        setWebsite(meetingPO.getWebsite());
        setWeiboName(meetingPO.getWeiboName());
        setWeiboUrl(meetingPO.getWeiboUrl());
        setFollowCount(meetingPO.getFollowCount());
        setDescription(meetingPO.getDescription());
    }
    
    public MeetingPO toMeetingPO() {
        MeetingPO meetingPO = new MeetingPO();
        
        meetingPO.setMeetingId(getMeetingId());
        meetingPO.setAbstracT(getAbstracT());
        meetingPO.setCharge(getCharge());
        meetingPO.setCity(getCity().toCityPO());
        meetingPO.setContactor(getContactor());
        meetingPO.setContactFax(getContactFax());
        meetingPO.setContactPhone(getContactPhone());
        meetingPO.setCoOrganizer(getCoOrganizer());
        meetingPO.setCreateTime(getCreateTime());
        meetingPO.setEmail(getEmail());
        meetingPO.setEndDate(getEndDate());
        meetingPO.setHot(getHot());
        meetingPO.setImage(getImage());
        meetingPO.setIndustry(getIndustry().toIndustryPO());
        meetingPO.setLocation(getLocation());
        meetingPO.setMeetingType(getMeetingType().toMeetingTypePO());
        meetingPO.setName(getName());
        meetingPO.setNameEn(getNameEn());
        meetingPO.setOrganizer(getOrganizer());
        meetingPO.setRecommend(getRecommend());
        meetingPO.setSponsor(getSponsor());
        meetingPO.setStartDate(getStartDate());
        meetingPO.setValuable(getValuable());
        meetingPO.setWebsite(getWebsite());
        meetingPO.setWeiboName(getWeiboName());
        meetingPO.setWeiboUrl(getWeiboUrl());
        meetingPO.setFollowCount(getFollowCount());
        meetingPO.setDescription(getDescription());
        
        return meetingPO;
    }
    
    /**
     * @return the meetingId
     */
    public Integer getMeetingId() {
        return meetingId;
    }
    /**
     * @param meetingId the meetingId to set
     */
    public void setMeetingId(Integer meetingId) {
        this.meetingId = meetingId;
    }
    /**
     * @return the abstracT
     */
    public String getAbstracT() {
        return abstracT;
    }
    
    public String getAbstracTEsc() {
    	if (StringUtils.isNotBlank(abstracT)) {
    		return StringEscapeUtils.escapeJavaScript(abstracT);
    	} else {
    		return abstracT;
    	}
    }
    
    /**
     * @param abstracT the abstracT to set
     */
    public void setAbstracT(String abstracT) {
        this.abstracT = abstracT;
    }
    /**
     * @return the charge
     */
    public Double getCharge() {
        return charge;
    }
    /**
     * @param charge the charge to set
     */
    public void setCharge(Double charge) {
        this.charge = charge;
    }
    /**
     * @return the city
     */
    public CityVO getCity() {
        return city;
    }
    /**
     * @param city the city to set
     */
    public void setCity(CityVO city) {
        this.city = city;
    }
    /**
     * @return the contactor
     */
    public String getContactor() {
        return contactor;
    }
    /**
     * @param contactor the contactor to set
     */
    public void setContactor(String contactor) {
        this.contactor = contactor;
    }
    /**
     * @return the contactFax
     */
    public String getContactFax() {
        return contactFax;
    }
    /**
     * @param contactFax the contactFax to set
     */
    public void setContactFax(String contactFax) {
        this.contactFax = contactFax;
    }
    /**
     * @return the contactPhone
     */
    public String getContactPhone() {
        return contactPhone;
    }
    /**
     * @param contactPhone the contactPhone to set
     */
    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }
    /**
     * @return the coOrganizer
     */
    public String getCoOrganizer() {
        return coOrganizer;
    }
    /**
     * @param coOrganizer the coOrganizer to set
     */
    public void setCoOrganizer(String coOrganizer) {
        this.coOrganizer = coOrganizer;
    }
    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }
    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }
    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }
    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }
    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
    /**
     * @return the hot
     */
    public Integer getHot() {
        return hot;
    }
    /**
     * @param hot the hot to set
     */
    public void setHot(Integer hot) {
        this.hot = hot;
    }
    /**
     * @return the image
     */
    public String getImage() {
        return image;
    }
    /**
     * @param image the image to set
     */
    public void setImage(String image) {
        this.image = image;
    }
    /**
     * @return the industry
     */
    public IndustryVO getIndustry() {
        return industry;
    }
    /**
     * @param industry the industry to set
     */
    public void setIndustry(IndustryVO industry) {
        this.industry = industry;
    }
    /**
     * @return the location
     */
    public String getLocation() {
        return location;
    }
    /**
     * @param location the location to set
     */
    public void setLocation(String location) {
        this.location = location;
    }
    /**
     * @return the meetingType
     */
    public MeetingTypeVO getMeetingType() {
        return meetingType;
    }
    /**
     * @param meetingType the meetingType to set
     */
    public void setMeetingType(MeetingTypeVO meetingType) {
        this.meetingType = meetingType;
    }
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }
    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * @return the nameEn
     */
    public String getNameEn() {
        return nameEn;
    }
    /**
     * @param nameEn the nameEn to set
     */
    public void setNameEn(String nameEn) {
        this.nameEn = nameEn;
    }
    /**
     * @return the organizer
     */
    public String getOrganizer() {
        return organizer;
    }
    /**
     * @param organizer the organizer to set
     */
    public void setOrganizer(String organizer) {
        this.organizer = organizer;
    }
    /**
     * @return the recommend
     */
    public Integer getRecommend() {
        return recommend;
    }
    /**
     * @param recommend the recommend to set
     */
    public void setRecommend(Integer recommend) {
        this.recommend = recommend;
    }
    /**
     * @return the sponsor
     */
    public String getSponsor() {
        return sponsor;
    }
    /**
     * @param sponsor the sponsor to set
     */
    public void setSponsor(String sponsor) {
        this.sponsor = sponsor;
    }
    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }
    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }
    /**
     * @return the valuable
     */
    public Integer getValuable() {
        return valuable;
    }
    /**
     * @param valuable the valuable to set
     */
    public void setValuable(Integer valuable) {
        this.valuable = valuable;
    }
    /**
     * @return the website
     */
    public String getWebsite() {
        return website;
    }
    /**
     * @param website the website to set
     */
    public void setWebsite(String website) {
        this.website = website;
    }
    /**
     * @return the weiboName
     */
    public String getWeiboName() {
        return weiboName;
    }
    /**
     * @param weiboName the weiboName to set
     */
    public void setWeiboName(String weiboName) {
        this.weiboName = weiboName;
    }
    /**
     * @return the weiboUrl
     */
    public String getWeiboUrl() {
        return weiboUrl;
    }
    /**
     * @param weiboUrl the weiboUrl to set
     */
    public void setWeiboUrl(String weiboUrl) {
        this.weiboUrl = weiboUrl;
    }

    public Integer getFollowCount() {
        return followCount;
    }

    public void setFollowCount(Integer followCount) {
        this.followCount = followCount;
    }
    
	/**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    public String getStartDateStr() {
		if (startDate != null) {
			return DateFormatUtils.format(startDate, "yyyy.MM.dd");
		} else {
			return "";
		}
	}
    
    public String getStartDateTimeStr() {
        if (startDate != null) {
            return DateFormatUtils.format(startDate, "yyyy-MM-dd HH:mm");
        } else {
            return "";
        }
    }
    
    public String getEndDateTimeStr() {
        if (endDate != null) {
            return DateFormatUtils.format(endDate, "yyyy-MM-dd HH:mm");
        } else {
            return "";
        }
    }
}
